package rs.etf.kdp.client;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Djordje Vukovic
 * @version 1.0
 * @created 16-May-2011 4:59:09 PM
 */
public class Components implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7092464054223521549L;
	private List<String> listOfComponents;
	

	public List<String> getListOfComponents() {
		return listOfComponents;
	}

	public Components(){
		listOfComponents = new ArrayList<String>();
	}

	public void loadFromFile(File file) throws IOException
	{
		FileReader fileReader = new FileReader(file);
		BufferedReader reader = new BufferedReader(fileReader);
		String line = null;
		while((line = reader.readLine())!=null)
		{
			listOfComponents.add(line);
		}
	}
	
	public String[] getComponentsArray()
	{
		String[] res = new String[listOfComponents.size()];
		for(int i=0; i<res.length; i++)
		{
			res[i] = listOfComponents.get(i);
		}
		return res;
		
	}

}